package com.xszx.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xszx.config.PageRequest;
import com.xszx.dao.CostDao;
import com.xszx.entity.Client;
import com.xszx.entity.Cost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CostService {
    @Autowired
    private CostDao costDao;
    public PageInfo<Cost> getCostListInfo(PageRequest pageRequest) {
        PageHelper.startPage(pageRequest.getPage(), pageRequest.getSize());
        List<Cost> costList = costDao.getCostListInfo(pageRequest);
        return new PageInfo<>(costList);
    }

    public void addCost(Cost cost) {
        costDao.addCost(cost);
    }


    public void updateCost(Cost cost) {
        costDao.updateCost(cost);
    }

    public void deletCost(Integer id) {
        costDao.deletCost(id);
    }
}
